package cn.atzxc.qy.service.impl;

import cn.atzxc.qy.domain.LoopAdvertisement;
import cn.atzxc.qy.mapper.LoopMapper;
import cn.atzxc.qy.service.LoopService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class LoopServiceImpl implements LoopService {
    @Autowired
    private LoopMapper loopMapper;
    /**
     * 获取公共图片
     * 直接查询出数据库中的公共图片
     * 主要是表中公共字段commonLoop字段为是
     * @return
     */
    @Override
    public List<LoopAdvertisement> getCommonLoopImage() {
        LambdaQueryWrapper<LoopAdvertisement> wrapper = new LambdaQueryWrapper<LoopAdvertisement>();
        wrapper.eq(LoopAdvertisement::getCommonLoop,"是");
        List<LoopAdvertisement> loopAdvertisements = loopMapper.selectList(wrapper);
        return loopAdvertisements;
    }

    @Override
    public List<LoopAdvertisement> getUniversityLoopImage(String university) {
        LambdaQueryWrapper<LoopAdvertisement> wrapper = new LambdaQueryWrapper<LoopAdvertisement>();
        wrapper.eq(LoopAdvertisement::getLoopUniversity,university);
        List<LoopAdvertisement> loopAdvertisements = loopMapper.selectList(wrapper);
//        System.out.println("获取到的列表是是哈哈哈哈"+loopAdvertisements);
        return loopAdvertisements;
    }
}
